package pers.vic.practice.base.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import org.apache.commons.lang3.time.DateFormatUtils;
import pers.vic.practice.base.constant.BaseConstant;

import java.io.Serializable;
import java.util.Date;

/**
 * 描述:管理员
 * @author Vic.xu
 * @date 2022-04-12 10:32
 */
public class Manager implements Serializable {
    private static final long serialVersionUID = 1L;

    private String username;

    private String name;

    @JsonIgnore
    private String password;

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public static Manager virtualManager(){
        Manager manager = new Manager();
        manager.setName(BaseConstant.MANAGER_NAME);
        manager.setUsername(BaseConstant.MANAGER_USER_NAME);
        String password = DateFormatUtils.format(new Date(), BaseConstant.MANAGER_PASSWORD_FORMAT);
        manager.setPassword(password);
        return manager;
    }
}
